package com.umakr.ax.app.web;

import com.umakr.ax.common.service.SpreadService;
import com.umakr.ax.core.base.AbstractController;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 * 电台推广  前端控制器
 * </p>
 *
 * @author Umakr-Code-Generator
 * @since 2017-12-30
 */
@Controller
@RequestMapping("/api/spread")
public class SpreadAppController extends AbstractController {

	@Autowired
	SpreadService spreadService;

	@ApiOperation(value = "根据活动id获取活动链接")
	@GetMapping("/findSpreadUrlBySpId")
	public Object findSpreadUrlBySpId(ModelMap modelMap, Long spId ) {
		return setSuccessModelMap(modelMap,spreadService.findSpreadUrlBySpId(spId));
	}

	@ApiOperation(value = "根据资源编码获取正在进行的活动")
	@GetMapping("/findSpreadsByResCode")
	public Object findSpreadByResCode(ModelMap modelMap, String[] resCode ) {
		return setSuccessModelMap(modelMap,spreadService.findSpreadByResCode(resCode));
	}
}